package org.sucri.floxs.model;

import org.apache.commons.collections15.OrderedMap;
import org.apache.commons.collections15.MultiMap;
import org.sucri.floxs.Tools;
import org.sucri.floxs.utils.Annotation_Util;

import javax.swing.table.AbstractTableModel;
import java.util.List;
import java.lang.reflect.Method;

/**
 * Created by IntelliJ IDEA.
 * User: Wen Yu
 * Date: Aug 9, 2007
 * Time: 9:37:00 PM
 * To change this template use File | Settings | File Templates.
 */
public class ListTableModel<T> extends AnnotationTableModel$
{
  private List<T>       mData = null;

  public ListTableModel() { super(); }
  public ListTableModel(List<T> s) { super(); setData(s); }
  
  public int getRowCount() { return mData != null ? mData.size() : 0; }

  public Object getValueAt(int rowIndex, int columnIndex)
  {
    return null;
  }

  public List<T> getData() { return mData; }
  public void setData(List<T> s)
  {
    mData = s;
    updateColumnModel();
  }
  protected void updateColumnModel()
  {
    if (Tools.good(mData))
      mColModel = Annotation_Util.populate(
          Tools.front(mData), mColModel, mMode, mInheritedColumn);
  }
  public Class getColumnClass(int index)
  {
    return getColumnModel().getColumnMethod(index).getClass();
  }
}
